package com.zendaimoney.test.simulation.dto.response.allinpay.quick.collect;

import com.zendaimoney.test.simulation.dto.response.RespDto;
import com.zendaimoney.test.simulation.utils.JaxbBinder;
import lombok.Data;
import lombok.ToString;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Document")
@XmlRootElement(name = "AIPG")
@Data
@ToString

/**
 * 快捷支付交易response
 */

public class QuickCollectResp extends RespDto {

    /**
     * 返回头
     */
    @XmlElement(name = "INFO")
    private QuickCollectRespHeader header;

    /**
     * 返回体
     */
    @XmlElement(name = "TRANSRET")
    private QuickCollectRespBody body;

    @Override
    public String encode() {
        JaxbBinder binder = new JaxbBinder(this.getClass());
        String xml = binder.toXml(this, "GBK");
        //报文头中需要替换掉standalone="yes",这个需要根据具体情况来确定
        return xml.replaceFirst(JaxbBinder.REPLACE_STANDALONE, "");
    }
}
